#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <time.h>
#include <math.h>
#include "rngs.h"

int checkAdventurer(int p, struct gameState *state) {

	printf("Testing Adventurer\n");
	int discardCount, handCount, deckCount, newDiscardCount, newHandCount, newDeckCount;
	discardCount = state->discardCount[p];
	deckCount = state->deckCount[p];
	handCount = state->handCount[p];

	printf("Calling Adventurer function\n");
	zzzadventurercardplay(0, p, 0, 0, 0, state);
	printf("lolz");

	newDeckCount = state->deckCount[p];
	newDiscardCount = state->discardCount[p];
	newHandCount = state->handCount[p];

	assert(newDeckCount + newDiscardCount == (deckCount + discardCount) - 2);
	assert(newHandCount == handCount + 1);

	return 0;
}

int main() {

	int r, p;
	int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};

	struct gameState G;

	SelectStream(2);
	PutSeed(3);

	for (int n = 0; n < 20; n++) {
		for (int i = 0; i < sizeof(struct gameState); i++) {
			((char*)&G)[i] = floor(Random() * 256);
		}
		p = floor(Random() * 3);
		printf("Initializing test game\n");
		G.deckCount[p] = floor(Random() * MAX_DECK);
		G.discardCount[p] = floor(Random() * (MAX_DECK - G.deckCount[p]));
		G.handCount[p] = floor(Random() * MAX_HAND);
		checkAdventurer(p, &G);
	}
}
